package com.itheima.pattern.flyweight;

import java.util.HashMap;
import java.util.Map;

public class BoxFactory {
    private HashMap<String,AbstractBox> map;
    private static BoxFactory factory=new BoxFactory();

    private BoxFactory(){
        map=new HashMap<>();
        map.put("I",new IBox());
        map.put("L",new LBox());
        map.put("O",new OBox());
    }

    public static BoxFactory getInstance(){
        return factory;
    }

    public AbstractBox getBox(String key){
        return map.get(key);
    }
}
